package com.ccp.dev.system.service;

import com.ccp.dev.core.basic.base.BaseService;
import com.ccp.dev.system.dao.SysTenantResourceDao;
import com.ccp.dev.system.model.SysTenantResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 租户与资源关联service
 * @author nd
 */
@Service
public class SysTenantResourceService extends BaseService<SysTenantResource> {
    @Resource
    SysTenantResourceDao tenantResourceDao;
    /**
     * 根据系统租户id和角色id获取角色资源
     * @param systemId  系统id
     * @param tenantId  租户id
     * @param roleId    角色id
     * @return  list
     */
    public List<SysTenantResource> queryByTenAndResAndRole(String systemId,String tenantId,String roleId){
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("systemId", systemId);
        params.put("tenantId", tenantId);
        params.put("roleId", roleId);
        return tenantResourceDao.queryByTenAndResAndRole(params);
    }
}
